package de.fhaugsburg.games.boardgames;

import java.util.List;
import java.util.Random;
import java.util.Vector;
/**
 * A RandomPool is a container for elements the special function is, the you can get a random element from this
 * container with the method take().
 * @author r4smus
 *
 * @param <T>
 */
public class RandomPool<T> {
	
	private Random random = new Random();
	private List<T> collection = new Vector<T>();
/**
 * put a element in the collection.	
 * @param o
 */
	public void put(T o){
		collection.add(o);
	}
/**
 * take a random element from the collection.
 * @return a random element from the collection.
 */
	public T take(){
		return collection.get(random.nextInt(collection.size()));
	}
/**
 * check if the collection is empty.
 * @return
 */
	public boolean empty(){
		if(collection.isEmpty()) return true;
		else return false;
	}
/**
 * @return the String representation of the collection.
 */
	public String toString(){
		return collection.toString();
	}
	
	
	
	
	

}
